package com.usf.jprovider.tools;

import java.math.BigInteger;
import java.util.Date;
import java.util.Random;

public final class RandomTools {

	private final static int CHAR_CODE_SIZE = 5;
	
	public final static int randomizeInteger(int max){
		return new Random().nextInt(max);
	}
	public final static int randomizeInteger(int min, int max){
		return new Random().nextInt(max - min + 1) + min;
	}
	
	public final static double randomizeDouble(Double min, Double max){
		return (new Random().nextDouble() * (max - min)) + min;
	}

	public final static Date randomizeDate(Date min, Date max){
		long time = Math.abs(new Random().nextLong() % (max.getTime() - min.getTime()));	
		return new Date(time + min.getTime());
	}
	
	public static String randomizeString(int count){
		Random random = new Random();
		return new BigInteger(count * CHAR_CODE_SIZE, random).toString(32);
	}
	public final static String randomizeNumericString(int count){
		StringBuilder value = new StringBuilder();
		Random random = new Random();
		for(int i=0; i< count; i++)
			value.append(random.nextInt(10));
		return value.toString();
	}
	
}
